package com.yanqu.road.server.cmd.wingroom.message;

import com.yanqu.road.pb.wingroom.WingRoomProto;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.command.Command;
import com.yanqu.road.server.logic.MessageHelper;
import com.yanqu.road.utils.YanQuMessageUtils;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.CrossProtocol;
import com.yanqu.road.server.protocol.GameProtocol;
import io.netty.channel.ChannelHandlerContext;

/**
 * @author ：zfr
 * @date ：2022/3/20 0:06
 */
@Cmd(code = CrossProtocol.C_WING_ROOM_NEW_MESSAGE_RESP, desc = "留言返回")
public class CrossNewMessageRespCmd implements Command {
    @Override
    public void execute(ChannelHandlerContext ctx, YanQuMessage packet) throws Exception {
        WingRoomProto.NewMessageRespCrossMsg respCrossMsg = WingRoomProto.NewMessageRespCrossMsg.parseFrom(packet.getBytes());
        YanQuMessage message = YanQuMessageUtils.buildMessage(GameProtocol.S_WING_ROOM_CROSS_NEW_MESSAGE_RESP, respCrossMsg.getRespMsg());
        MessageHelper.sendPacket(respCrossMsg.getGuestServerId(), respCrossMsg.getGuestUserId(), message);
    }
}
